home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsICookiePermission.idl < prev    next >
Text File  |  2006-05-08  |  5KB  |  142 lines

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3.  *
  4.  * The contents of this file are subject to the Mozilla Public License Version
  5.  * 1.1 (the "License"); you may not use this file except in compliance with
  6.  * the License. You may obtain a copy of the License at
  7.  * http://www.mozilla.org/MPL/
  8.  *
  9.  * Software distributed under the License is distributed on an "AS IS" basis,
  10.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  * for the specific language governing rights and limitations under the
  12.  * License.
  13.  *
  14.  * The Original Code is cookie manager code.
  15.  *
  16.  * The Initial Developer of the Original Code is
  17.  * Michiel van Leeuwen (mvl@exedo.nl).
  18.  * Portions created by the Initial Developer are Copyright (C) 2003
  19.  * the Initial Developer. All Rights Reserved.
  20.  *
  21.  * Contributor(s):
  22.  *
  23.  * Alternatively, the contents of this file may be used under the terms of
  24.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  25.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26.  * in which case the provisions of the GPL or the LGPL are applicable instead
  27.  * of those above. If you wish to allow use of your version of this file only
  28.  * under the terms of either the GPL or the LGPL, and not to allow others to
  29.  * use your version of this file under the terms of the MPL, indicate your
  30.  * decision by deleting the provisions above and replace them with the notice
  31.  * and other provisions required by the GPL or the LGPL. If you do not delete
  32.  * the provisions above, a recipient may use your version of this file under
  33.  * the terms of any one of the MPL, the GPL or the LGPL.
  34.  *
  35.  * ***** END LICENSE BLOCK ***** */
  36.  
  37. #include "nsISupports.idl"
  38.  
  39. interface nsICookie2;
  40. interface nsIURI;
  41. interface nsIChannel;
  42.  
  43. typedef long nsCookieAccess;
  44.  
  45. /**
  46.  * An interface to test for cookie permissions
  47.  */
  48. [scriptable, uuid(91f1c3ec-73a0-4bf0-bdc5-348a1f181b0e)]
  49. interface nsICookiePermission : nsISupports
  50. {
  51.   /**
  52.    * nsCookieAccess values
  53.    */
  54.   const nsCookieAccess ACCESS_DEFAULT = 0;
  55.   const nsCookieAccess ACCESS_ALLOW   = 1;
  56.   const nsCookieAccess ACCESS_DENY    = 2;
  57.  
  58.   /**
  59.    * additional values for nsCookieAccess, which are not directly used by
  60.    * any methods on this interface, but are nevertheless convenient to define
  61.    * here. these may be relocated somewhere else if we ever consider freezing
  62.    * this interface.
  63.    */
  64.   const nsCookieAccess ACCESS_SESSION = 8;
  65.  
  66.   /**
  67.    * setAccess
  68.    *
  69.    * this method is called to block cookie access for the given URI.  this
  70.    * may result in other URIs being blocked as well (e.g., URIs which share
  71.    * the same host name).
  72.    *
  73.    * @param aURI
  74.    *        the URI to block
  75.    * @param aAccess
  76.    *        the new cookie access for the URI.
  77.    */
  78.   void setAccess(in nsIURI         aURI,
  79.                  in nsCookieAccess aAccess);
  80.  
  81.   /**
  82.    * canAccess
  83.    *
  84.    * this method is called to test whether or not the given URI/channel may
  85.    * access the cookie database, either to set or get cookies.
  86.    *
  87.    * @param aURI
  88.    *        the URI trying to access cookies
  89.    * @param aFirstURI
  90.    *        the URI initiated by the user that resulted in aURI being loaded
  91.    * @param aChannel
  92.    *        the channel corresponding to aURI
  93.    *
  94.    * @return one of the following nsCookieAccess values:
  95.    *         ACCESS_DEFAULT, ACCESS_ALLOW, or ACCESS_DENY
  96.    */
  97.   nsCookieAccess canAccess(in nsIURI     aURI,
  98.                            in nsIURI     aFirstURI,
  99.                            in nsIChannel aChannel);
  100.  
  101.   /**
  102.    * canSetCookie
  103.    *
  104.    * this method is called to test whether or not the given URI/channel may
  105.    * set a specific cookie.  this method is always preceded by a call to
  106.    * canAccess. it may modify the isSession and expiry attributes of the
  107.    * cookie via the aIsSession and aExpiry parameters, in order to limit
  108.    * or extend the lifetime of the cookie. this is useful, for instance, to
  109.    * downgrade a cookie to session-only if it fails to meet certain criteria.
  110.    *
  111.    * @param aURI
  112.    *        the URI trying to set the cookie
  113.    * @param aChannel
  114.    *        the corresponding to aURI
  115.    * @param aCookie
  116.    *        the cookie being added to the cookie database
  117.    * @param aIsSession
  118.    *        when canSetCookie is invoked, this is the current isSession attribute
  119.    *        of the cookie. canSetCookie may leave this value unchanged to
  120.    *        preserve this attribute of the cookie.
  121.    * @param aExpiry
  122.    *        when canSetCookie is invoked, this is the current expiry time of
  123.    *        the cookie. canSetCookie may leave this value unchanged to
  124.    *        preserve this attribute of the cookie.
  125.    *
  126.    * @return true if the cookie can be set.
  127.    */
  128.   boolean canSetCookie(in nsIURI     aURI,
  129.                        in nsIChannel aChannel,
  130.                        in nsICookie2 aCookie,
  131.                        inout boolean aIsSession,
  132.                        inout PRInt64 aExpiry);
  133. };
  134.  
  135. %{ C++
  136. /**
  137.  * The nsICookiePermission implementation is an XPCOM service registered
  138.  * under the ContractID:
  139.  */
  140. #define NS_COOKIEPERMISSION_CONTRACTID "@mozilla.org/cookie/permission;1"
  141. %}
  142.